package com.macro.mall.controller;

import com.macro.mall.common.api.CommonPage;
import com.macro.mall.common.api.CommonResult;
import com.macro.mall.model.UmsMenu;
import com.macro.mall.model.UmsPermission;
import com.macro.mall.model.UmsResource;
import com.macro.mall.model.UmsRole;
import com.macro.mall.service.CmsStreamTestService;
import com.macro.mall.service.UmsRoleService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.apache.commons.lang.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * 后台用户角色管理
 * Created by macro on 2018/9/30.
 */
@Controller
@Api(tags = "CmsStreamTestController", description = "视频点播测试")
@RequestMapping("/stream")
public class CmsStreamTestController {
    @Autowired
    private CmsStreamTestService cmsStreamTestService;

    @ApiOperation("生成点播流")
    @RequestMapping(value = "/generateDemandStream", method = RequestMethod.POST)
    @ResponseBody
    public CommonResult create(@RequestBody String videoId) {
         String videoStream=cmsStreamTestService.generateDemandStream(videoId);
         if(!StringUtils.isBlank(videoStream)){
             return CommonResult.success(videoStream);
         }
         return CommonResult.failed();
    }
}
